if (HSMBUILD_DISPATCHER_FREERTOS)
    set(HSM_DEFINITIONS_FREERTOS ${HSM_DEFINITIONS_BASE} -DHSM_BUILD_HSMBUILD_DISPATCHER_FREERTOS CACHE STRING "" FORCE)
    add_definitions(-DHSM_BUILD_HSMBUILD_DISPATCHER_FREERTOS)
    add_library(${HSM_LIBRARY_NAME}_freertos STATIC ${CMAKE_CURRENT_SOURCE_DIR}/src/HsmEventDispatcherFreeRTOS.cpp)
    target_compile_options(${HSM_LIBRARY_NAME}_freertos PUBLIC -fPIC)
    target_include_directories(${HSM_LIBRARY_NAME}_freertos PRIVATE ${FREERTOS_INCLUDE}
                                                                    ${HSMBUILD_FREERTOS_CONFIG_FILE_DIRECTORY})

    # Export variables
    set(HSMCPP_FREERTOS_CXX_FLAGS ${HSMCPP_CXX_FLAGS} CACHE STRING "" FORCE)
    set(HSMCPP_FREERTOS_LIB ${HSM_LIBRARY_NAME}_freertos ${HSMCPP_LIB} ${CMAKE_THREAD_LIBS_INIT} CACHE STRING "" FORCE)
    set(HSMCPP_FREERTOS_INCLUDE ${HSMCPP_INCLUDE} ${FREERTOS_INCLUDE} CACHE STRING "" FORCE)

    if (HSMBUILD_FREERTOS_DEFAULT_ISR_DETECT)
        set(HSMCPP_FREERTOS_CXX_FLAGS ${HSMCPP_FREERTOS_CXX_FLAGS} -DBUILD_FREERTOS_DEFAULT_ISR_DETECT=1 CACHE STRING "" FORCE)
    endif()
endif()